import { _decorator, Component, Label, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('ToastMgr')
export class ToastMgr extends Component {
    @property({ type: Label })
    toastLab: Label = null;
    @property({ type: Node })
    nodeToast: Node = null;
  
    show(msg:string,showTime:number){
        this.toastLab.string=msg;
        this.nodeToast.active=true;
        this.schedule(this.hide, showTime);
    }

    hide(){
        this.nodeToast.active=false; 
    }
    // 清理调度器
    onDestroy() {
        this.unschedule(this.hide);
    }

   

    
}


